#include<bits/stdc++.h>
using namespace std;
int cnt=0;
bool ishuiwen(int x)
{
	string y=to_string(x),z=y;
	reverse(y.begin(),y.end());
	if(z==y)return true;
	else return false;
}

int rev(int x)
{
	string y=to_string(x);
	reverse(y.begin(),y.end());
	return stoi(y);
}
int main()
{
	//cout<<rev(120);
	//cout<<ishuiwen(323);
	int n;
	cin>>n;
	while(!ishuiwen(n))
	{
		cnt++;
		n+=rev(n);
	}
	cout<<cnt<<" "<<n;
	return 0;
}
